<?php echo $this->load->view('meta'); ?>
<link rel="stylesheet" href="<?php echo base_url()?>css/admin.css" type="text/css" media="screen" />
<title>xa-ncsu | blog</title>
<link rel="stylesheet" href="<?php echo base_url()?>css/impromptu.css" type="text/css" media="screen" />
<script type="text/javascript" src="<?php echo base_url();?>js/jquery-impromptu.1.2.js"></script>
<script>
function vhconfirm(v,m)
        {
            if( v )
            {
                var f =  document.createElement("form");document.body.appendChild(f);f.method = "POST";f.action = $("#" + v ).attr( "href" );f.submit();
            } else
            {
                return false;
            }
        }
</script>
<?php echo $this->load->view('header'); ?>
<ul class="nav-list">
	<li><?php echo anchor('blog', 'view blog');?></li>
	<li class="last"><?php echo anchor('blog/publish', 'create a new entry');?></li>
</ul>
<?php if ($comments->num_rows() > 0): ?>
<table>	
	<tr>
		<th>author</th>
		<th>comment</th>
		<th>posted</th>
		<th>actions</th>
	</tr>
<?php foreach ($comments->result() as $comment): ?>
<tr>
	<td><?php echo $comment->authorname?><?php if(isset($comment->author)) : ?> ( <?php echo $comment->author?> ) <?php endif; ?></td>
	<td><?php echo $comment->body?></td>
	<td><?php echo $comment->posted?></td>
	<td>
		<a href="<?php echo site_url();?>blog/editComment/<?php echo $comment->id?>"><img src="<?php echo base_url();?>img/icons/page_edit.png" alt="Edit Comment" title="Edit Comment" /></a>
		<?php if($comment->approved === 'n') : ?><a href="<?php echo site_url();?>admin/approveComment/<?php echo $comment->id?>"><img src="<?php echo base_url();?>img/icons/tick.png" alt="Approve Comment" title="Approve Comment" /></a><?php endif;?>
		<a href="<?php echo site_url();?>blog/deleteComment/<?php echo $comment->id?>" id="conf<?php echo $comment->id?>" onclick="$.prompt('Delete Comment?',{callback: vhconfirm, buttons: { Yes : 'conf<?php echo $comment->id?>', No : false}}); return false;">
			<img src="<?php echo base_url();?>img/icons/delete.png" alt="Delete Comment" title="Delete Comment" /></a>
	</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</table>
<?php echo $this->load->view('footer'); ?>
